<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/2
 * Time: 14:32
 */

namespace app\admin\validate;


use think\Validate;

class System extends Validate
{
    protected $rule =   [
        'cfg_name'  => 'require|unique:system',
        'cfg_info'  => 'require',
        'more'      => 'requireIf:type,select'
    ];
    protected $message  =   [
        'cfg_name.require' => '配置ID不能为空',
        'cfg_name.unique'  => '配置ID必须唯一',
        'cfg_info.require' => '配置项名称不能为空',
        'more.requireIf'   => '下拉菜单形式，附加信息必填'
    ];
    protected $scene = [
        'add'  =>  ['cfg_name','cfg_info'],
        'edit' =>  ['cfg_info']
    ];
}